# Contributor: knuxify <knuxify@gmail.com>
# Maintainer: knuxify <knuxify@gmail.com>
pkgname=gpick
pkgver=0.3
pkgrel=2
pkgdesc="Advanced color picker written in C++ using GTK+ toolkit"
url="http://gpick.org"
arch="all"
license="BSD-3-Clause"
_luaver=5.4
makedepends="cmake ragel gtk+3.0-dev boost-dev lua$_luaver-dev lua$_luaver-libs
	expat-dev"
subpackages="$pkgname-doc $pkgname-lang"
source="https://github.com/thezbyg/gpick/releases/download/v$pkgver/gpick-$pkgver.tar.gz
	revert-cpp-lua.patch"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	export CXXFLAGS="$CXXFLAGS -L/usr/lib/lua$_luaver -llua"
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DLua_LIBRARIES="/usr/lib/lua$_luaver/liblua.so" \
		-DLua_INCLUDE_DIRS="$(pkg-config --variable=includedir lua$_luaver )" \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	./build/tests
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	install -Dm644 installer/License.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="
bf782c3be6399439589da9d6c59dc21af9551818412b3c197b375ba93fe9cba6fee0f668b81db653f04a1817e33fc87c8d8faf27d305d26ee61f119b8d4af987  gpick-0.3.tar.gz
d3b858683e67956e7df4dc1042f410ce4b04091c47668ccef869b304af5139bef8d14b67d35aa0595bfcd5e86e070d52f7af7489a1f2a833703225a817e02729  revert-cpp-lua.patch
"
